package com.bhs.sansong.view;

import android.app.Activity;
import android.view.View;
import android.widget.TextView;

import com.bhs.sansong.R;
import com.google.android.material.tabs.TabLayout;

public class SelectedFont implements TabLayout.OnTabSelectedListener {

    private Activity activity;
    public SelectedFont(Activity activity) {
        this.activity = activity;
    }

    @Override
    public void onTabSelected(TabLayout.Tab tab) {
        View customView = tab.getCustomView();
        if (customView == null) {
            tab.setCustomView(R.layout.tab_text_layout);
        }
        TextView textView = tab.getCustomView().findViewById(android.R.id.text1);
        textView.setTextAppearance(activity, R.style.TabLayoutTextSelectedBlack);

    }

    @Override
    public void onTabUnselected(TabLayout.Tab tab) {
        View customView = tab.getCustomView();
        if (customView == null) {
            tab.setCustomView(R.layout.tab_text_layout);
        }
        TextView textView = tab.getCustomView().findViewById(android.R.id.text1);
        textView.setTextAppearance(activity, R.style.TabLayoutTextUnSelectedBlack);
    }

    @Override
    public void onTabReselected(TabLayout.Tab tab) {

    }
}
